{include file="common:meta" /}

    <title>会员列表 - 会员管理 - TXCMS_V2</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
<style>
    #pname{
        position: relative;
        top:10px;
        font-size: 14px;
    }
</style>
</head>
<body>
{include file="common:header" /}

{include file="common:menu" /}

<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a href="{:url('index/index')}">首页</a> <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 会员列表<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray mt-20" style="margin-top: 0px;">
                <div class="l"><a href="javascript:;" onclick="member_add('添加代理','/admin.php/admin/agent/add','','510')" class='btn btn-secondary-outline radius'><i class='Hui-iconfont'>&#xe600;</i> 添加代理</a>
                </div>
                <div class="l"><a href="javascript:;" onclick="member_add('添加指定用户下级','/admin.php/admin/user/add_user_subordinate','','510')" class='btn btn-secondary-outline radius'><i class='Hui-iconfont'>&#xe600;</i> 添加指定用户下级</a>
                </div>
                <div class="l">
                {$child_nick ? "<div><a onclick='member_add_user($child_id);' class='btn btn-secondary-outline radius'><i class='Hui-iconfont'>&#xe600;</i> 添加($child_nick)的下级</a></div>" : "<div><a onclick='user_add_s();' class='btn btn-success-outline radius'><i class='Hui-iconfont'>&#xe600;</i> 添加用户</a></div>"}
                </div>
                <div class="l">
                    {$child_nick ? "<div><a onclick='daili_add($child_id);' class='btn btn-secondary-outline radius'><i class='Hui-iconfont'>&#xe600;</i> 添加($child_nick)的下级代理</a></div>" : ""}
                </div>
            </div>

            <form class="form-inline" role="form" method="get" action="{:url('user/search')}">
                <div class="form-group">
                    <span style="color: red;">代理用户查询</span> 昵称:<input style="width: 120px;" type="text" class="input-text" name="nickname" placeholder="请输入昵称" value="{$nickname ? $nickname : '';}">
                    账号:<input style="width: 120px;" type="text" class="input-text" name="username" placeholder="请输入账号" value="{$username ? $username : '';}">
                    手机号:<input style="width: 120px;" type="text" class="input-text" name="phone" placeholder="请输入手机号" value="{$phone ? $phone : '';}">
                    <span class="select-box" style="width: 120px;">
              <select name="status"  class="select">
                  <option value="" selected>请选择游客或者正式</option>
                  <option value="{$status ? $status : '0';}">游客</option>
                  <option value="{$status ? $status : '1';}">正式</option>
              </select>
        </span>
                    开始时间：<input type="text" class="input-text radius size-S" style="width: 100px" autocomplete="off" name="startTime" id="test3">-<input type="text" class="input-text radius size-S" style="width: 100px" name="endTime" id="test4" autocomplete="off">
                </div>
                <button type="submit" class="btn btn-default">用户查询</button>
            </form>
            <div id="pname">{$pname ?? ''}</div>
            <div class="mt-20" >
                <div class="table-responsive">
                <table style="white-space: nowrap;word-break:keep-all;" class="table table-border table-bordered table-hover table-bg table-sort" id="table">
                    <tr class="text-c">
                        <th width="50">ID</th>
                        <th>昵称</th>
                        <th width="70">账号</th>
                        <th>下级数量</th>
                        <th>下级</th>
                        <th>总余额(bank+携带)</th>
                        <th>积分</th>
                        <th>手机</th>
                        <th>银行卡</th>
                        <th width="">加入时间</th>
                        <th>上次登录ip</th>
                        <th>是否游客</th>
                        <th>是否锁定</th>
                        <th>操作</th>
                    </tr>
                    {volist name="data" id="vo"}
                    <tr class="text-c">
                        <td id="id1">{$vo.id}</td>
                        <td>{$vo.nickname} ({if condition="$vo.agent === 0"}代理{else /}用户{/if})</td>
                        <td>{$vo.username}</td>
                        <td>{php}echo ($vo['rgt']-$vo['lft']-1)/2;{/php}</td>
                        <td><a {if condition="($vo['rgt']-$vo['lft']-1)/2 == 0"}hidden{else /}{/if} href="/admin.php/admin/user/getchildreno?id={$vo.id}" id="send" style="color:red">查看下级</a></td>
                        <td>{$vo.coin}</td>
                        <td>{$vo.vip_exp}</td>
                        <td>{$vo.phone}</td>
                        <td>
                            <a href="javascript:;" onClick="edit_bank_card('卡号修改','/admin.php/admin/agent/edit_bank_card?id={$vo.id}&aid={$vo.agent}','4','','400')" class="ml-5" style="text-decoration:none">{$vo.bank_card}</a>
                        </td>
                        <td>{$vo.create_time}</td>
                        <td>{$vo.active_ip}</td>
                        <td>{if condition="$vo.status==0"}游客{else /}正式{/if}</td>
                        <td>{if condition="$vo.lock==0"}未锁定{else /}锁定{/if}</td>
                        <td class="td-manage">
                            <a href="javascript:;" onClick="member_edit('编辑','/admin.php/admin/agent/edit?id={$vo.id}&aid={$vo.agent}','4','','400')" class="btn btn-primary-outline radius size-MINI" style="text-decoration:none">编辑</a>
                            <a href="javascript:;" onClick="member_re('充值','/admin.php/admin/agent/recharge?id={$vo.id}&aid={$vo.agent}','4','','200')" class="btn btn-secondary-outline radius size-MINI" style="text-decoration:none">充值</a>
                            <a href="javascript:;" onClick="member_re('邮件','/admin.php/admin/user/displayMail?id={$vo.id}','4','','400')" class="btn btn-success-outline radius size-MINI" style="text-decoration:none">邮件</a>
                            <a style="text-decoration:none" class="btn btn-warning-outline radius size-MINI" onClick="change_password('修改密码','/admin.php/admin/agent/changePassword?id={$vo.id}&aid={$vo.agent}','10001','600','270')" href="javascript:;" title="修改密码">改密</a>
                            <a style="text-decoration:none" class="btn btn-secondary-outline radius size-MINI" onClick="zhuanYi('转移','/admin.php/admin/agent/transfer?id={$vo.id}&aid={$vo.agent}','10001','600','270')" href="javascript:;" title="修改密码">转移</a>
                            <a href="javascript:;" onclick="member_del({$vo.id},{$vo.agent})" class="btn btn-danger-outline radius size-MINI" style="text-decoration:none">删除</a></td>
                    </tr>
                    {/volist}
                </table>
                </div>
                {$quick ?? ''}
            </div>
            <div style="float: right;">{$page}</div>
        </article>
    </div>
</section>

{include file="common:footer" /}


<script type="text/javascript">
    /*用户-编辑*/
    function member_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*卡号-编辑*/
    function edit_bank_card(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*密码-修改*/
    function change_password(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*密码-修改*/
    function zhuanYi(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-删除*/
    function member_del(id,agent){
//        $.post('/admin.php/admin/agent/del',{'id':id,'aid':agent},function (res) {
//            if(res.code=0){
//                layer.msg(res.msg);
//            }else{
//                layer.msg(res.msg);
//                setTimeout(function () {
//                    window.location.reload();
//                },1000)
//            }
//        })
        layer.confirm('确定要删除吗？', {
            btn: ['确定','再想想'] //按钮
        }, function(){
            $.ajax({
                url:"{:url('agent/del')}",
                type:'post',
                data:{'id':id,'aid':agent},
                success:function (res) {
                    if(res.code === 0){
                        layer.msg(res.msg);
                    }else{
                        layer.msg(res.msg);
                        setTimeout(function(){
                            parent.location.reload();
                        }, 1000);
                    }
                }
            });
        })
    }
    /*用户-充值*/
    function member_re(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    laydate.render({
        elem: '#test3' //指定元素
        ,calendar: true
        ,theme: '#333'
        ,showBottom: true    //false隐藏控件底部按钮
    });
    laydate.render({
        elem: '#test4' //指定元素
        ,calendar: true
        ,theme: '#333'
        ,showBottom: true   //false隐藏控件底部按钮
    });

    function member_add_user(id){
        var phone = browserRedirect();
        if(phone===0){
            area = [480+'px', 510 +'px'];
        }else{
            area = ['100%', '100%'];
        }
        layer.open({
            type: 2,
            area:area,
            title: '用户添加',
            shadeClose: true,
            content: '/admin.php/admin/user/add?id='+id //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
        });
    }

    /*代理-增加*/
    function daili_add(id){
        var phone = browserRedirect();
        if(phone===0){
            area = [480+'px', 510 +'px'];
        }else{
            area = ['100%', '100%'];
        }
        layer.open({
            type: 2,
            area:area,
            title: '下级代理添加',
            shadeClose: true,
            content: '/admin.php/admin/user/daili_add?id='+id //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响

        });
    }

    function user_add_s(){
        var phone = browserRedirect();
        if(phone===0){
            area = [480+'px', 510 +'px'];
        }else{
            area = ['100%', '100%'];
        }
        layer.open({
            type:2,
            title:'用户添加',
            area:area,
            shadeClose: true,
            content: '/admin.php/admin/user/designated_user'
        });
    }

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>